import { constantRoutes } from '@/router'


const permission = {
  state: {
    routes: [],
    addRoutes: [],
    sidebarRouters: []
  },
  mutations: {
    SET_ROUTES: (state, routes) => {
      state.addRoutes = routes
      state.routes = constantRoutes.concat(routes)
    },
    SET_SIDEBAR_ROUTERS: (state, routers) => {
      state.sidebarRouters = constantRoutes.concat(routers)
    },
  },
  actions: {
    // 生成路由
    GenerateRoutes({ commit },data) {
      const sidebarRouters=[]
      const rewriteRoutes=[]
      rewriteRoutes.push({ path: '*', redirect: '/404', hidden: true })
      commit('SET_SIDEBAR_ROUTERS', sidebarRouters)
    }
  }
}



export default permission
